// 封装获取频道列表的数据
import { useState, useEffect } from 'react'
import { getChannelApi } from '../apis/article'
function useChannel() {
  // 获取频道列表
  const [channelList, setChannelList] = useState([])

  useEffect(() => {
    // 获取频道列表
    const getChannelList = async () => {
      const res = await getChannelApi()
      setChannelList(res.data.channels)
    }
    getChannelList()
  }, [])
  return { channelList }
}

export { useChannel };